package Observer.Stock;

public class Client {
    public static void main(String[] args) {
        AbstractStockPrice future1 = new StockFutures("111");
        AbstractStockPrice future2 = new StockFutures("222");
        AbstractStockPrice future3 = new StockFutures("333");

        AbstractStockPrice common1 = new StockCommon("555");
        AbstractStockPrice common2 = new StockCommon("666");
        AbstractStockPrice common3 = new StockCommon("777");

        IStockHolder buy1 = new BuyHolder("Buy1");
        IStockHolder buy2 = new BuyHolder("Buy2");
        IStockHolder buy3 = new BuyHolder("Buy3");
        IStockHolder sell1 = new SellHolder("Sell1");
        IStockHolder sell2 = new SellHolder("Sell2");
        IStockHolder sell3 = new SellHolder("Sell3");

        buy1.addHolder(future1);
        buy1.addHolder(future2);
        buy1.addHolder(common1);

        buy2.addHolder(future1);
        buy2.addHolder(future3);
        buy2.addHolder(common2);

        buy3.addHolder(future3);
        buy3.addHolder(future3);
        buy3.addHolder(common3);

        sell1.addHolder(future1);
        sell1.addHolder(future2);
        sell1.addHolder(common1);

        sell2.addHolder(future1);
        sell2.addHolder(future2);
        sell2.addHolder(common3);

        sell3.addHolder(future1);
        sell3.addHolder(common2);
        sell3.addHolder(common1);


        for(int i = 0; i > -5; --i)
        {
            future1.setPrice(1+i);
            future2.setPrice(1+i);
            future3.setPrice(1+i);

            common1.setPrice(1+i);
            common2.setPrice(1+i);
            common3.setPrice(1+i);
        }
    }
}
